<template>
  <div style="    overflow: auto;" class="app-container">
    <!-- <hear></hear> -->
    <!-- <el-image 
    style="width: 100px; height: 100px"
    :src="url" 
    :preview-src-list="srcList">
  </el-image> -->
    <div class="backoff">
      <div class="sdiv">
        <div
          style="
            width: 100px;
            height: 30px;
            color: #333;
            font-size: 20px;
            -webkit-box-orient: vertical;
            -webkit-box-direction: normal;
            -ms-flex-direction: column;
            flex-direction: column;
            -webkit-box-align: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-pack: center;
            -ms-flex-pack: center;
            justify-content: center;
          "
        >
          快递详情
        </div>
        <div style="display: flex;">
             <el-button class="anniu"  @click="quxiao()" >取消订单</el-button>
              <el-button class="anniu" @click="quad">返回</el-button>
        </div>
      </div>
    </div>
    <div class="tac" tab-position="left">
      <div>
        <div class="cions">发货人信息</div>
        <div class="cionss">
          <!-- <div class="cions-tet">
            <div class="cions-yxy">公司名称：</div>
            <div style="color: #40abf6">{{farmdata.sender_company}}</div>
          </div> -->
          <div class="cions-tet">
            <div class="cions-yxy">联系人：</div>
            <div style="color: #40abf6">{{farmdata.sender_contact}}</div>
          </div>
             <div class="cions-tet">
            <div class="cions-yxy">联系电话：</div>
            <div style="color: #40abf6">{{farmdata.sender_mobile}}</div>
          </div>
             <div class="cions-tet">
            <div class="cions-yxy">地址：</div>
            <div style="color: #40abf6">{{farmdata.sender_address}}</div>
          </div>
 
        </div>
      </div>
      <div>
        <div class="cions">收货人信息</div>
          <div class="cionss">
          <!-- <div class="cions-tet">
            <div class="cions-yxy">公司名称：</div>
            <div style="color: #40abf6">{{farmdata.receive_company}}</div>
          </div> -->
          <div class="cions-tet">
            <div class="cions-yxy">联系人：</div>
            <div style="color: #40abf6">{{farmdata.receive_contact}}</div>
          </div>
             <div class="cions-tet">
            <div class="cions-yxy">联系电话：</div>
            <div style="color: #40abf6">{{farmdata.receive_mobile}}</div>
          </div>
             <div class="cions-tet">
            <div class="cions-yxy">地址：</div>
            <div style="color: #40abf6">{{farmdata.receive_address}}</div>
          </div>
 
        </div>
      </div>
      <div>
        <div class="cions">产品信息</div>
        <div class="cionss">
          <div class="cions-tet">
            <div class="cions-yxy">产品名称：</div>
            <div style="color: #40abf6">{{farmdata.goods_name}}</div>
          </div>
          <div class="cions-tet">
            <div class="cions-yxy">产品数量：</div>
            <div style="color: #40abf6">{{farmdata.goods_count}}</div>
          </div>
            <div class="cions-tet">
            <div class="cions-yxy">产品价格：</div>
            <div style="color: #40abf6">{{farmdata.goods_amount}}</div>
          </div>
        </div>
      </div>
      <div>
        <div class="cions">订单信息</div>
        <div class="cionss">
         <div class="cions-tet">
            <div class="cions-yxy">订单号：</div>
            <div style="color: #40abf6">{{farmdata.order_no}}</div>
          </div>
          <div class="cions-tet">
            <div class="cions-yxy">物流单号：</div>
            <div style="color: #40abf6">{{farmdata.express_no}}</div>
          </div>
          <div class="cions-tet">
            <div class="cions-yxy">下单日期：</div>
            <div style="color: #40abf6">{{farmdata.createtime}}</div>
          </div>
          <div class="cions-tet">
            <div class="cions-yxy">下单状态：</div>
            <div style="color: #40abf6">{{farmdata.status_text}}</div>
          </div>
        </div>
      </div>
      <div>
        <div class="cions">物流追踪</div>
        <div class="cionss">
        <el-timeline >
    <el-timeline-item     v-for="(activity, index) in wuliu"
      :key="index"
     placement="top">
       <!-- :timestamp="activity.acceptTime"  -->
      <el-card class="kuaidi">
         <div style="color: #e2b16a;padding-right: 20px;">{{activity.acceptTime}}</div>
        <div style="color: #8d6bff;padding-right: 20px;">{{activity.acceptAddress}}</div>
        <p style="color: #9a9494">{{activity.remark}}</p>
      </el-card>
    </el-timeline-item>
  </el-timeline>
          
        </div>
      </div>
    </div>
    <!-- <binad></binad> -->
  </div>
</template>
    
<script>
// import hear from ".././../components/hear.vue";
// import binad from ".././../components/dinad.vue";
import { sfdetail,sfroute,sfcancel } from "@/api/system/liucheng";
// import { snfiledown } from "@/api/xin.js";
export default {
  components: {
    // hear,
    // binad,
  },
  data() {
    return {
      formLabelAlign: {}, //申请公司信息
      chjg: {}, //出汗机构
      shenqingInfo: {}, //申请信息
      baohanFile: "", //保函文件
      shenqishenpiFilengInfo: "", //审批文件
      payList: "", //支付记录
      kdList: "", //快递记录
      applyno: "",
      jinduInfo: {}, //进度信息
      url: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
      srcList: [
        "https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg",
      ],
      farmdata:{

      },
      wuliu:[]
    };
  },
  created() {
    //   this.get_weidaili();
    //   this.get_daili();
    this.getDetail(this.$route.query.order_no);
        this.guiji(this.$route.query.order_no);
        this.id=this.$route.query.order_no
  },
  methods: {
    quxiao(){
 this.$confirm('此操作将取消该订单, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.qusxiao(this.id)
        
        }).catch(() => {
        //   this.$message({
        //     type: 'info',
        //     message: '已取消'
        //   });          
        });
    },
    handleClick(tab, event) {
      console.log(tab, event);
    },
    dataURLtoBlob(dataurl) {
      var bstr = atob(dataurl);
      var n = bstr.length;
      var u8arr = new Uint8Array(n);
      while (n--) {
        u8arr[n] = bstr.charCodeAt(n);
      }
      return new Blob([u8arr], { type: "pdf" });
    },
    // 获取详情
    getDetail(id) {
      console.log('获取快递详情',id)
      sfdetail({
        order_no: id,
      }).then((res) => {
        console.log(res.data.data.data);
      this.farmdata=res.data.data.data
      });
    },
    quad(){
   this.$router.push({name:'PersonalView',query:{second:"second"}});
    },
       // 取消
    qusxiao(id) {
   
      sfdetail({
        order_no: id,
      }).then((res) => {
        console.log('取消快递',res)
        var bcin=123
      if(res.data.data.code==1){
          this.$message({
            type: 'success',
            message: '取消成功!'
          });
// console.log("传的值",bcin)
          //  this.$router.push({name:'userCenter',query:{second:bcin}});
          this.$router.push({name:'userCenter', params: {key: "second"}})
      }else{
        this.$message({
          showClose: true,
          message: res.data.data.msg,
          type: 'error'
        });
      }
      });
    },
       // 获取订单轨迹
    guiji(id) {
   
      sfroute({
        order_no: id,
      }).then((res) => {
this.wuliu=res.data.data.data.routes
         console.log('获取获取订单轨迹',id,res)
      });
    },
  },
};
</script>
<style>
.kuaidi .el-card__body{
  display: flex;
}
</style>
<style scoped lang="scss">
.weidaili_head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tac {
//   height: 100%;
  padding: 20px;
}
.cions {
  padding: 5px 10px;
  background: #dddddd;
}
.cions-tet {
  display: flex;
  padding: 10px 20px 0;
  padding-left: 0;
}
.cionss {
  padding: 5px 10px;
  padding-bottom: 10px;
}
.cions-yxy {
  width: 80px;
  display: flex;
  justify-content: end;
}
.search {
  float: right;
  width: 20%;
  height: 40px;
  border: 1px solid #ccc;
  border-radius: 5px;
  display: flex;

  ::v-deep.el-input__inner {
    border: none !important;
  }

  .el-button {
    border: none;
  }
}

::v-deep.el-input__inner {
  border: none !important;
}

.weidaili {
  height: 75vh;
  margin-bottom: 10px;
  overflow: hidden;
}

.block {
  width: 95%;
  padding-right: 5%;
  display: flex;
  justify-content: flex-end;
}

.showphoto {
  height: 553px;
  background: #f5f6fa;
  border-radius: 4px 4px 4px 4px;
  opacity: 1;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
}

.showphoto1 {
  height: 553px;
  background: #f5f6fa;
  border-radius: 4px 4px 4px 4px;
  opacity: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.el-tabs .el-tab-pane {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  // overflow-y: auto;
}

.app-container {
  //   height: calc(100vh + 50px);
  // height: calc(100vh - 136px);
  padding-bottom: 0px;
  position: relative;
  // display: flex;
  // flex-direction: column;
  // position: relative;
}

// ::v-deep .el-tabs__content {
//   // height: 100% !important;
// }

.public-ku {
  margin-top: 1.375rem;
  width: 443.8px;
  height: 250px;
  margin-bottom: 1.25rem;
}
.kuang-txt {
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 800;
}
.pdf {
  width: 50px;
  height: 50px;
}
.kuang-1 {
  font-size: 1.1625rem;
  line-height: 2.3125rem;
  margin-left: 1.25rem;
  margin-top: 0.375rem;
  font-family: Microsoft YaHei;
  font-weight: 800;
  color: #333333;
}
.fromsBox {
  width: 100%;
  overflow: auto;
  /* margin: 0px auto; */
  margin-top: 60px;
  padding: 0 15%;
  padding-bottom: 40px;

  .el-form-item {
    margin-bottom: 4px;
    margin-left: 20px;
  }
}

.title {
  font-weight: bold;
  margin-bottom: 10px;
}

.left {
  width: 70%;
  margin: 0px auto;
  margin-top: 60px;
}

.conter {
  margin-left: 20px;
  // width: 85%;
}

.backoff {
  //   position: absolute;
  //   z-index: 999;
  //   left: 222px;
  //   top: 83px;
  // margin-left: 180px;
  display: flex;
  justify-content: flex-end;
  padding: 5px 0;
  box-sizing: border-box;

  .sdiv {
    width: 100%;
    // width: calc(100vw - 240px);
    display: flex;
    justify-content: space-between;
    padding-right: 20px;
    padding-left: 20px;
  }

  .el-button {
    border: 1px solid;
  }
}

.rzBox {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%);

  .el-button {
    width: 150px !important;
  }
}

.renzhng {
  flex: 1;
  overflow-y: auto;
  padding: 0 10%;

  .el-form-item {
    margin-bottom: 4px;
  }
}

.footer {
  display: flex;
  padding-left: 10px;
  box-sizing: border-box;
  height: 45px;
  // justify-content: center;
  align-items: center;
  background-color: #f4f4f5 !important;

  .btn {
    width: 80px;
    height: 35px;
    border: 1px solid #1795ff;
  }
}

.table {
  margin-top: 50px;
}
.public-kuang {
  margin-top: 0.5rem;
  //   width: 750px;
  height: 85px;
  padding: 0.5125rem 0.55rem;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;

  //   flex-direction: column;
  /* justify-content: space-between; */
  /* align-items: center; */
  background: #ffffff;
  -webkit-box-shadow: 0rem 0rem 0.1875rem 0rem rgb(0 0 0 / 15%);
  box-shadow: 0rem 0rem 0.1875rem 0rem rgb(0 0 0 / 15%);
}
.kuang-txt {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  font-weight: 800;
}
.kuang-1 {
  font-size: 1.1625rem;
  line-height: 2.3125rem;
  margin-left: 1.25rem;
  margin-top: 0.375rem;
  font-family: Microsoft YaHei;
  font-weight: 800;
  color: #333333;
}
.kuang-2 {
  width: 4.125rem;
  height: 2.0375rem;
  line-height: 1.375rem;
  text-align: center;
  /* border-radius: 20px; */
  background: #069cff;
  border: 0.0625rem solid #069cff;
  font-size: 1rem;
  font-family: Microsoft YaHei;
  font-weight: 400;
  padding: 0.3125rem 0.5125rem;
  color: #fff;
}
</style>
    